package com.cbts.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * BusinessTravel entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "business_travel", catalog = "cbts")
public class BusinessTravel implements java.io.Serializable {

	// Fields

	private Integer infoId;
	private UserInfo userInfo;
	private BusinessTravelList businessTravelList;
	private TravelStandard travelStandard;
	private String startPlace;
	private String endPlace;
	private Double distance;
	private Integer time;
	private Double sum;

	// Constructors

	/** default constructor */
	public BusinessTravel() {
		distance=0.00;
		time=0;
		sum=0.00;
	}

	/** minimal constructor */
	public BusinessTravel(Integer infoId, UserInfo userInfo,
			BusinessTravelList businessTravelList, String startPlace,
			String endPlace, Double distance, Integer time, Double sum) {
		this.infoId = infoId;
		this.userInfo = userInfo;
		this.businessTravelList = businessTravelList;
		this.startPlace = startPlace;
		this.endPlace = endPlace;
		this.distance = distance;
		this.time = time;
		this.sum = sum;
	}

	/** full constructor */
	public BusinessTravel(Integer infoId, UserInfo userInfo,
			BusinessTravelList businessTravelList,
			TravelStandard travelStandard, String startPlace, String endPlace,
			Double distance, Integer time, Double sum) {
		this.infoId = infoId;
		this.userInfo = userInfo;
		this.businessTravelList = businessTravelList;
		this.travelStandard = travelStandard;
		this.startPlace = startPlace;
		this.endPlace = endPlace;
		this.distance = distance;
		this.time = time;
		this.sum = sum;
	}

	// Property accessors
	@Id
	@Column(name = "infoId", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY) 
	public Integer getInfoId() {
		return this.infoId;
	}

	public void setInfoId(Integer infoId) {
		this.infoId = infoId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userid", nullable = false)
	public UserInfo getUserInfo() {
		return this.userInfo;
	}

	public void setUserInfo(UserInfo userInfo) {
		this.userInfo = userInfo;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "travelOrder", nullable = false)
	public BusinessTravelList getBusinessTravelList() {
		return this.businessTravelList;
	}

	public void setBusinessTravelList(BusinessTravelList businessTravelList) {
		this.businessTravelList = businessTravelList;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "standardId")
	public TravelStandard getTravelStandard() {
		return this.travelStandard;
	}

	public void setTravelStandard(TravelStandard travelStandard) {
		this.travelStandard = travelStandard;
	}

	@Column(name = "startPlace", nullable = false, length = 45)
	public String getStartPlace() {
		return this.startPlace;
	}

	public void setStartPlace(String startPlace) {
		this.startPlace = startPlace;
	}

	@Column(name = "endPlace", nullable = false, length = 45)
	public String getEndPlace() {
		return this.endPlace;
	}

	public void setEndPlace(String endPlace) {
		this.endPlace = endPlace;
	}

	@Column(name = "distance", nullable = false, precision = 11)
	public Double getDistance() {
		return this.distance;
	}

	public void setDistance(Double distance) {
		this.distance = distance;
	}

	@Column(name = "time", nullable = false)
	public Integer getTime() {
		return this.time;
	}

	public void setTime(Integer time) {
		this.time = time;
	}

	@Column(name = "sum", nullable = false, precision = 11)
	public Double getSum() {
		return this.sum;
	}

	public void setSum(Double sum) {
		this.sum = sum;
	}

}